import request from '@/utils/request'

// 获取菜单列表
export const fetchMenuList = (parentId, params) => {
    return request({
        url: '/menu/list/' + parentId,
        method: 'get',
        params: params
    })
}

// 删除菜单
export const deleteMenu = (id) => {
    return request({
        url: '/menu/delete/' + id,
        method: 'post'
    })
}

//创建菜单
export const createMenu = (data) => {
    return request({
        url: '/menu/create',
        method: 'post',
        data: data
    })
}

//更新菜单
export const updateMenu = (id, data) => {
    return request({
        url: '/menu/update/' + id,
        method: 'post',
        data: data
    })
}

//获取菜单
export const getMenu = (id) => {
    return request({
        url: '/menu/' + id,
        method: 'get',
    })
}

//更新隐藏
export const updateHidden = (id, params) => {
    return request({
        url: '/menu/updateHidden/' + id,
        method: 'post',
        params: params
    })
}

//获取菜单树
export const fetchMenuTreelist = () => {
    return request({
        url: '/menu/treeList',
        method: 'get'
    })
}